import os

SITE_ROOT = os.path.dirname(os.path.relpath(__file__))

ROOT_URLCONF = 'amscms.urls'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MESSAGE_STORAGE='django.contrib.messages.storage.session.SessionStorage'

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
    "django.core.context_processors.media",
    
    # Facebook Open ID
    "socialauth.context_processors.facebook_api_key",

    # Private Messages messages_inbox_count
    "amscms.private_messages.context_processors.inbox"
    
)

MIDDLEWARE_CLASSES = (
    'django.middleware.gzip.GZipMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.csrf.CsrfMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    
    # Open ID
    'openid_consumer.middleware.OpenIDMiddleware',
    'amscms.core.middleware.FixedLocaleMiddleware.FixedLocaleMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    
    # Multiple Login
    'amscms.core.middleware.MultipleLoginMiddleware.MultipleLoginMiddleware',
    
    # Ads
    'amscms.ams.middleware.AdViewMiddleware.AdViewMiddleware',
    'amscms.ams.middleware.AdTagExploreMiddleware.AdTagExploreMiddleware',
    'amscms.core.middleware.CurrentSiteMiddleware.CurrentSiteMiddleware',
    
    # Breadcrumbs
    'breadcrumbs.middleware.BreadcrumbsMiddleware',
    
    # Flat pages
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

TEMPLATE_DIRS = (
    os.path.join(SITE_ROOT, 'templates'),
    os.path.join(SITE_ROOT, 'ams/templates'),
    os.path.join(SITE_ROOT, 'core/templates'),
    os.path.join(SITE_ROOT, 'payment/templates'),
    os.path.join(SITE_ROOT, 'reports/templates'),
    os.path.join(SITE_ROOT, 'feeds/templates'),
    os.path.join(SITE_ROOT, 'faq/templates'),
    os.path.join(SITE_ROOT, 'about/templates'),
)

